/**
 * Loading Spinner Component
 * 
 * Unified loading state indicator
 */

import { RefreshCw, Loader2 } from 'lucide-react';
import { cn } from '@/lib/utils';

interface LoadingSpinnerProps {
  size?: 'sm' | 'md' | 'lg';
  className?: string;
  variant?: 'default' | 'minimal';
}

const sizeClasses = {
  sm: 'w-4 h-4',
  md: 'w-6 h-6',
  lg: 'w-8 h-8',
};

export function LoadingSpinner({ 
  size = 'md', 
  className,
  variant = 'default' 
}: LoadingSpinnerProps) {
  const Icon = variant === 'minimal' ? Loader2 : RefreshCw;
  
  return (
    <div className={cn('flex items-center justify-center', className)}>
      <Icon className={cn(
        sizeClasses[size],
        'animate-spin text-primary',
        variant === 'minimal' && 'text-muted-foreground'
      )} />
    </div>
  );
}

export function LoadingOverlay({ message }: { message?: string }) {
  return (
    <div className="flex flex-col items-center justify-center p-8 gap-4">
      <LoadingSpinner size="lg" />
      {message && (
        <p className="text-sm text-muted-foreground">{message}</p>
      )}
    </div>
  );
}
